<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

<body>
    <input type="text" name="" id="" class="inp">
    <button class="btn">search</button>
    <script>
        
        $('.btn').click(() => {
            // $(input[type='text']).val();
            const inp=$(".inp").val()
            $.ajax({
                method: 'get',
                url: `http://localhost:8080/hair_kind_search?name=${inp}`,
                success(data) {
                    console.log(data);
                },
                error(err) {
                    console.log(err);
                }
            })
        })
    </script>
</body>

</html>